<?php
class Member extends AppModel {
    var $name = 'Member';
    var $virtualFields = array(
        'name_and_number' => 'CONCAT(Member.name, " ", Member.camarilla_number)'
    );
    var $validate = array(
        'name' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                //'message' => 'Your custom message here',
                //'allowEmpty' => false,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'camarilla_number' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                //'message' => 'Your custom message here',
                //'allowEmpty' => false,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
            'camarilla_number' => array(
                'rule' => '/^[A-Z]{2}[0-9]{6,12}(T|)$/',
                'message' => 'Camarilla number not valid, please use contry code in caps and correct number of digets'
            ),
            'isUnique' => array(
                'rule' => 'isUnique',
                'message' => 'Camarilla number already exists'
            )
        ),
    );
    //The Associations below have been created with all possible keys, those that are not needed can be removed

    var $hasMany = array(
        'Request' => array(
            'className' => 'Request',
            'foreignKey' => 'member_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );

}
?>